module AboutYou
  module SDK
    module Model
      ###
      # This class represents an result error model
      ###
      module ResultError
        # error ident
        attr_accessor :error_ident
        # error code
        attr_accessor :error_code
        # error message
        attr_accessor :error_message

        ###
        # Constructor for the AboutYou::SDK::Model::ResultError class
        #
        # * *Args* :
        #   - +json_object+ -> the json_object received from the api
        #
        # * *Returns* :
        #   - an instance of AboutYou::SDK::Model::ResultError
        ###
        def initialize(json_object)
          parse_error_result(json_object)

          self
        end

        ###
        # This method parses the error result
        #
        # * *Args* :
        #   - +json_object+ -> the json_object received from the api
        ###
        def parse_error_result(json_object)
          self.error_ident   = json_object.key?('error_ident') ? String(json_object['error_ident']) : nil
          self.error_code    = json_object.key?('error_code') ? Integer(json_object['error_code']) : 0
          self.error_message = json_object.key?('error_message') ? json_object['error_message'] : nil
        end
      end
    end
  end
end
